Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a few typos #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

a few typos #19

wants to merge 1 commit into from

Conversation

mildsunrise
Copy link
Contributor

a handful of lil typos found while typechecking the codebase. despite them being obvious typos, I did not apply these changes to master because the fix might break things:

  • new Date().time doesn't exist, so the check was always failing and returning stats even if they are stale. fixing the typo makes it return null when stats are stale, as intended.

  • an attribute was named maxa instead of max. fixing it could break code relying on the typo.

a handful of lil typos found while typechecking
the codebase. despite them being obvious typos,
I did not apply these changes to master because the
fix might break things:

- `new Date().time` doesn't exist, so the check was
  always failing and returning stats even if they are
  stale. fixing the typo makes it return `null` when
  stats are stale, as intended.

- an attribute was named `maxa` instead of `max`.
  fixing it could break code relying on the typo.
@@ -64,8 +64,8 @@ class VideoEncoder extends Emitter
const scaleResolutionToHeight = params.scaleResolutionToHeight ? parseInt(params.scaleResolutionToHeight) : 0;
const allowedDownScaling = scaleResolutionToHeight && params.hasOwnProperty("allowSameHeight")? (params.allowSameHeight ? 1 : 2) : 0;
//Get default for width and heights
const width = parseInt(params.width) ? parseInt(params.width) : (scaleResolutionDownBy ? 640 : 0);
const height = parseInt(params.height) ? parseInt(params.height) : (scaleResolutionDownBy ? 480 : 0);
const width = params.width ? parseInt(params.width) : (scaleResolutionDownBy ? 640 : 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to sanitize input data, iirc swig crashes if wrong type is used

Suggested change
const width = params.width ? parseInt(params.width) : (scaleResolutionDownBy ? 640 : 0);
const width = parseInt(params.width) ?? 0;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

your suggestion removes the default of 640, are you sure we want that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that should be the ultimate goal, we can be consertative and just do this instead

Suggested change
const width = params.width ? parseInt(params.width) : (scaleResolutionDownBy ? 640 : 0);
const width = parseInt(params.width) ?? (scaleResolutionDownBy ? 640 : 0);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants